<?php


namespace app\user\model;


use think\Model;

class DetailModel extends Model
{
    protected $name = 'detail';

    public function getImageAttr($imger)
    {
        return request()->domain() . $imger;
    }
    public function getImagesAttr($images)
    {
        $imageArr = explode(',',$images);
        if (count($imageArr) > 0){
            foreach ($imageArr as $key => $image){
                $imageArr[$key] = request()->domain().$image;
            }
            return $imageArr;
        }
        return [];
    }

    public function child()
    {
        return $this->hasMany(TermModel::class,'productid','id');
    }
}